|
|
|
|
|
|
|
Listing 12.16. Coding the Command1_Click event of the control. |
|
|
|
|
|
|
|
|
Private Sub Command1_Click()
'
' user pressed the button!
'
Dim varTemp As Variant
'
LoadProperties
frmFind.Show vbModal
If frmFind.CloseFlag = True Then
varTemp = frmFind.SelectedValue
Unload frmFind
RaiseEvent Selected(varTemp)
Else
Unload frmFind
RaiseEvent Cancel
End If
'
End Sub |
|
|
|
|
|
|
|
|
Notice that this last bit of code fires off the Selected and Cancel events, depending on the value stored in the frmFind.CloseFlag variable. You'll code the frmFind form in the next section. |
|
|
|
|
|
|
|
|
Finally, to round out the control, add the following two subroutines to the project (see Listing 12.17). These create two public methods that can be called from within the user's program. |
|
|
|
|
|
|
|
|
Listing 12.17. Adding the ReturnSelected and ReturnCancel methods. |
|
|
|
|
|
|
|
|
Public Sub ReturnSelected()
'
RaiseEvent Selected(frmFind.DBList1.BoundText)
'
End Sub
Public Sub ReturnCancel()
'
RaiseEvent Cancel
'
End Sub |
|
|
|
|
|
|
|
|
That is all the coding you need to do for the first part of the custom control. Be sure to save the control and the project before continuing to the next section. |
|
|
|
|
|